package src.stu23002131.chapter07;

import java.util.Iterator;
import java.util.LinkedHashSet;

public class Demo10 {public static void main(String[] args) {
    LinkedHashSet set_23002131 = new LinkedHashSet();
    set_23002131.add("张三");                   // 向该Set集合中添加字符串
    set_23002131.add("李四");
    set_23002131.add("王五");
    Iterator it = set_23002131.iterator();  // 获取Iterator对象
    while (it.hasNext()){           // 通过while循环，判断集合中是否有元素
        Object obj = it.next();
        System.out.println(obj);
    }
}
}
